Various methods have been suggested for measuring, without contact, a depth of a three-dimensional scene, that is, a distance to each subject. Such methods can be classified into an active method and a passive method. In the active method, a subject is irradiated with infrared rays, ultrasonic waves, or laser beams so as to calculate the subject based on a length of time until a wave which is reflected returns or an angle of the reflected wave. In the passive method, the distance is calculated based on an image of the subject. Particularly, in the case of using a camera to measure the distance to the subject, the passive method which does not require an apparatus for emitting infrared rays and so on is widely used.
Various passive methods have been suggested, one of which is referred to as Depth from Defocus (hereinafter, referred to as DFD) which is a method to measure the distance based on a blur generated by focus change. The DFD has features such as not requiring a plurality of cameras, allowing distance measurement using a small number of images, and so on.
Hereinafter, a principle of the DFD is briefly described.
Assuming that a captured image is I(x, y), and an original image which has no blur due to a lens is S(x, y), a relationship as shown in Expression 1 can be established between I(x, y) and S(x, y).[Math. 1]I(x,y)=S(x,y)*h(x,y,d(x,y))  Expression 1
Here, h denotes a Point Spread Function (hereinafter, referred to as PSF) which represents a blur condition in an optical system, while d denotes the distance to the subject in the position (x, y) on the captured image or the original image. Thus, the h represents a function which depends on the aforementioned position (x, y) and the subject distance d. In addition, * in the expression represents convolution operation.
The expression 1 includes S and d as unknown quantities. Here, images I2 for a single scene are captured, changing focal positions. Change in the focal position corresponds to change in the PSF with respect for a single subject distance. In other words, Expression 2 comes into effect.[Math. 2]I2(x,y)=S(x,y)*h′(x,y,d(x,y))  Expression 2
Here, h′ denotes a PSF in a focal position different from the focal position for h. The original image S and the subject distance d in the scene can be obtained by solving these expressions. Various solutions for the original image S and the subject distance d have been suggested in Patent Literature 1 and others.